#pragma once
#include "stdafx.h"
#include "QueryIntermediateRepresentation.h"
#include "Operator.h"
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
/*
 generate query plan tree, initialize the operators, the queues 
*/
class PlanManager:private boost::noncopyable
{
private:
	static PlanManager* planManager;
	PlanManager(void);
	std::list<boost::shared_ptr<Operator> >operatorList;
	void addOperatorToList(boost::shared_ptr<Operator>op);//the first input is root op, add the operator by post order
#ifdef DEBUG
	void setOperatorIdAndQueueId(void);
#endif
public:
	~PlanManager(void);   
	static PlanManager* getInstance();
	void generateQueryPlan(boost::shared_ptr<QueryIntermediateRepresentation>queryIntermediate);
	std::list<boost::shared_ptr<Operator> > getOperatorList(void);

};
